//
//  SQLTool.m
//  FRP_OC
//
//  Created by DeLong Yang on 2017/8/7.
//  Copyright © 2017年 DeLongYang. All rights reserved.
//

#import "SQLTool.h"

@implementation SQLTool

+ (NSString *)makeSQL:(void(^)(SQLTool *tool))block {
    if (block) {
        SQLTool *tool = [[SQLTool alloc] init];
        block(tool);
        return tool.sql;
    }
    return nil;
}

- (Select)select {
    return ^(NSArray<NSString *> *columns) {
        if (columns.count > 0) {
            self.sql = [NSString stringWithFormat:@"SELECT %@", [columns componentsJoinedByString:@","]];
        } else {
            self.sql = @"SELECT *";
        }
        //这里将自己返回出去
        return self;
    };
}

@end
